package ejb.dto;

import java.util.Date;
import java.util.List;


public class PeriodDTO {
	
	private int id;

	private String description;

	private Date fromDate;

	private String name;

	private Date toDate;

	private List<PackageDTO> packages;

	//GETTER AND SETTER

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getFromDate() {
		return this.fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getToDate() {
		return this.toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public List<PackageDTO> getPackages() {
		return this.packages;
	}

	public void setPackages(List<PackageDTO> packages) {
		this.packages = packages;
	}

	//METHODS
	
	/**
	 * Add PackageDTO to list
	 * @param pack
	 * @return list of PackageDTO
	 */
	public PackageDTO addPackage(PackageDTO pack) {
		getPackages().add(pack);
		pack.setPeriod(this);

		return pack;
	}

	/**
	 * Remove PackageDTO from list
	 * @param pack
	 * @return list of PackageDTO
	 */
	public PackageDTO removePackage(PackageDTO pack) {
		getPackages().remove(pack);
		pack.setPeriod(null);

		return pack;
	}

}